<?php
namespace app\api\validate;

use think\Validate;

/**
 * Class CashchildValidate
 * @package app\api\validate
 * @author zhenHong~
 */
class CashchildValidate extends Validate{

    protected $rule = [
        'a_id' => ['require','regex' => '/^[+]{0,1}(\d+)$/'],
        'name' => ['require','regex' => '0?(13|14|15|17|18|19)[0-9]{9}'],
        'pass' => ['require'],
        'checkPass' => ['require','confirm'=>'pass'],
        'ids' => ['require'],
        'page' => ['regex' => '/^[+]{0,1}(\d+)$/'],
        'pageNum' => ['regex' => '/^[+]{0,1}(\d+)$/'],
        'ids'     => ['require'],
        'id'      => ['require']
    ];

    protected $message = [
        'a_id.require' => 'a_id不能为空',
        'a_id.regex' => '参数错误a_id',
        'name.require' => '账号不能为空',
        'name.regex' => '账号格式错误,必须为手机号',
        'pass' => '密码不能为空',
        'checkPass' => '密码不一致',
        'ids' => '子商户id参数',
        'page' => '分页参数错误',
        'pageNum' => '记录条数错误',
        'ids'     => '账号id不能为空',
        'id'      => 'id不能为空'
    ];

    protected $scene = [
        //  添加子商户
        'addCashChild' => ['a_id','name','pass'],
        // 删除商户子账号
        'delCashChild' => ['ids'],
        // 修改商户子账号
        'editCashChild'=> ['id','name','pass']
    ];
}